package com.crm.mapper.system;

import com.crm.aonnation.AutoFill;
import com.crm.dto.QueryDictTypeDto;
import com.crm.enumeration.OperationType;
import com.crm.pojo.Dict;
import com.crm.pojo.DictData;
import com.crm.pojo.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DictTypeMapper {
    Page<Dict> page(QueryDictTypeDto dto);

    @Select("select * from tb_user where user_id=#{userId} ")
    User searchByUserId(Long userId);

    @AutoFill(value = OperationType.INSERT)
    @Insert("insert into tb_dict ( dict_name, dict_type, status, dsc, create_time, update_time, create_by, update_by) " +
            "values (#{dictName},#{dictType},#{status},#{remark},#{createTime},#{updateTime},#{createBy},#{updateBy})")
    void add(Dict dict);

    @Select("select *,id as dictId from tb_dict where id=#{id}")
    Dict getById(Integer id);
    @Select("select *, id as dictId from tb_dict where dict_type=#{dictType}")
    Dict getByDictType(String dictType);
    @AutoFill(value = OperationType.UPDATE)
    void update(Dict dict);

    List<Dict> seachByIds(List<Integer> ids);

    void delete(List<Integer> ids);


}
